import * as echarts from 'echarts/core'

import {
    BarChart,
    LineChart,
    LinesChart,
    PieChart,
    RadarChart,
    ScatterChart,
    EffectScatterChart,
    GaugeChart,
    CustomChart,
    MapChart,
} from 'echarts/charts'
import {
    TitleComponent,
    ToolboxComponent,
    GraphicComponent,
    TooltipComponent,
    GridComponent,
    DatasetComponent,
    VisualMapComponent,
    LegendComponent,
    PolarComponent,
    TransformComponent,
    GeoComponent,
    DataZoomComponent,
} from 'echarts/components'

import type {
    BarSeriesOption,
    LineSeriesOption,
    LinesSeriesOption,
    PieSeriesOption,
    RadarSeriesOption,
    ScatterSeriesOption,
    EffectScatterSeriesOption,
    GaugeSeriesOption,
    CustomSeriesOption,
    MapSeriesOption,
} from 'echarts/charts'

import type {
    TitleComponentOption,
    ToolboxComponentOption,
    TooltipComponentOption,
    GridComponentOption,
    GeoComponentOption,
    GraphicComponentOption,
    DatasetComponentOption,
    DataZoomComponentOption,
    VisualMapComponentOption,
    LegendComponentOption,
} from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'
import type { ComposeOption } from 'echarts/core'
// 标签自动布局、全局过渡动画等特性
import { LabelLayout, UniversalTransition } from 'echarts/features'
import 'echarts-liquidfill'

export type ECOption = ComposeOption<
    | BarSeriesOption
    | PieSeriesOption
    | LineSeriesOption
    | LinesSeriesOption
    | RadarSeriesOption
    | ScatterSeriesOption
    | EffectScatterSeriesOption
    | GaugeSeriesOption
    | CustomSeriesOption
    | MapSeriesOption
    | TitleComponentOption
    | ToolboxComponentOption
    | TooltipComponentOption
    | GridComponentOption
    | DatasetComponentOption
    | DataZoomComponentOption
    | VisualMapComponentOption
    | LegendComponentOption
    | GeoComponentOption
    | GraphicComponentOption
>

echarts.use([
    TitleComponent,
    ToolboxComponent,
    TooltipComponent,
    GridComponent,
    DatasetComponent,
    DataZoomComponent,
    VisualMapComponent,
    LegendComponent,
    PolarComponent,
    TransformComponent,
    GeoComponent,
    GraphicComponent,
    LabelLayout,
    UniversalTransition,
    CanvasRenderer,
    BarChart,
    LineChart,
    LinesChart,
    PieChart,
    RadarChart,
    ScatterChart,
    EffectScatterChart,
    GaugeChart,
    CustomChart,
    MapChart,
])

export default echarts
